<%@ page language="java" contentType="text/html;charset=utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%
    //String mcode = (String)request.getAttribute("mcode");
	//System.out.println("mcode==========="+mcode);
	String mcode = request.getParameter("mcode");
	System.out.println("mcode==========="+mcode);
	String ip = request.getHeader("x-forwarded-for");       
	if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
		ip = request.getHeader("Proxy-Client-IP");
	}       
	if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {           
		ip = request.getHeader("WL-Proxy-Client-IP");       
	}       
	if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {           
		ip = request.getRemoteAddr();       
	}  	
	String type = request.getHeader("User-Agent");		

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<div id="head"></div>
<div id="main">
  <c:if test="${markItem.zhengimgshow==1&&markItem.zhengimg != null && markItem.zhengimg != ''}">
    <div id="pro_kuang">
    <img class="img" src="${pageContext.request.contextPath}/showImage/${id}/zm.sv" width="432" height="432"/>
    </div>
  </c:if>
      <div id="pro_title"></div>
      
      <div id="pro_list">
         
         <ul>
            <c:if test="${markItem.brandshow==1&&markItem.brandname !=null}">
           <li>英文品牌：${markItem.brandname}</li>
           </c:if>
            <c:if test="${markItem.zhongbrandshow==1&&markItem.zhongbrandname !=null}">
           <li>中文品牌：${markItem.zhongbrandname}</li>
           </c:if>
            <c:if test="${markItem.typesshow==1&&markItem.typesname !=null}">
           <li>种类：${markItem.typesname}</li>
           </c:if>
           <c:if test="${markItem.originshow==1&&markItem.originname !=null}">
           <li>产地：${markItem.originname} </li>
           </c:if>
             <c:if test="${markItem.materialshow==1&&markItem.childList.size()>0}">
                 <c:forEach  items="${markItem.childList}" var="material" varStatus="var">
                     <li><c:choose><c:when test="${var.index == 0}">材质：</c:when><c:otherwise>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</c:otherwise></c:choose>${material.remark} &nbsp ${material.namezhong} &nbsp   ${material.percentage}%
                     </li>
                 </c:forEach>
             </c:if>
           
         </ul>
            
      </div>
      <input type="hidden" id="qrcode" value="${markItem.qrcode}"/>
      <div id="ma">
      
        <div id="ma_left"><img src="/static/img/erweima.jpg" width="290" height="242" /></div>
        
        <div id="ma_right">
        
          <div id="title">请核对溯源验证码</div>
          
          <div id="ma_bg"></div>
        
        </div>
      
      </div>
    
    </div>
</html>
<script type="text/javascript">
var id=$("#qrcode")[0].value;
var qrcode=id.substring(25);
$("#ma_bg").html(qrcode);
</script>



<script type="text/javascript">


    function showgps(position){
		if (position){
			latitude = position.coords.latitude;
            longitude = position.coords.longitude;
            //alert("latitude: " + latitude + "\r\n longitude: "+ longitude);
			if(isfirst=="0"){
				$.ajax({  
					type : "post",  
					url : "do.scan",  
					data : {mcode:mcode,ip:ip,type:type,gps:longitude+","+latitude},  
					async : true,  
					success : function(data){
					}  
				}); 				
			}		
        }
                //else
                    //alert("position is null");
		//return position.coords.longitude+","+position.coords.latitude		
      }	
</script>
